var client = require('net').connect(4001, 'localhost', function(){
    client.write('client message');
    client.on('data', function(data){
        console.log(data.toString());
        client.end('bye bye');
    });
    client.on('end', function(){
        console.log('client disconnected');
    });
});
